<?php

namespace app\common\model\resources;
use app\common\model\BaseModel;

/**
 * 资源模型类
 * Class User
 * @package app\common\model
 */
class Resources extends BaseModel
{
    protected $name = 'resources_resources';


    /**
     * 关联文章封面图
     * @return \think\model\relation\HasOne
     */
    public function image()
    {
        return $this->hasOne('app\\common\\model\\UploadFile', 'file_id', 'down_id');
    }

    /**
     * 文章详情
     * @param $resources_idd
     * @return null|static
     * @throws \think\exception\DbException
     */
    public static function detail($resources_id)
    {
        return self::get($resources_id,['image']);
    }
}
